//
//  Product_SeriesViewController.m
//  ShoppingExperience
//
//  Created by LiYinDi on 15-5-18.
//  Copyright (c) 2015年 RuiBen. All rights reserved.
//

#import "Product_SeriesViewController.h"
//#import "ProductCommonTableViewCell.h"
#import "ProductCommon2TableViewCell.h"
#import "UIImageView+WebCache.h"
#import "GuideListTableViewCell.h"
#import "OldMeterialTableViewCell.h"
//#import "ChengSeTableViewCell.h"
#import "HZAreaPickerView.h"
#import <CoreLocation/CoreLocation.h>
#import "SearchMemberTableViewCell.h"


#import "FactoryNewProductLeftTableViewCell.h"

@interface Product_SeriesViewController ()<ProductCommon2TableViewCellDelegate,HZAreaPickerDelegate>
{
    NSMutableArray *mSeriesArray;
    NSMutableArray *seriesCodeAray;
    NSMutableArray *seriesNameArray;
    NSMutableArray *onHandArray;
    
  
    
    NSUInteger _PageIndex;
    NSUInteger _TotalCount;
    NSUInteger _TotalPage;
    
   // NSMutableArray *mItemsArray;
    NSMutableArray *itemCodeArray;
    NSMutableArray *itemNameArray;
    NSMutableArray *itemWhereArray;
    NSMutableArray *itemPriceArray;
    NSMutableArray *itemUrlArray;
    NSMutableArray *itemWeightArray;
    NSMutableArray *itemSeriesNameArray;
    NSMutableArray *itemTypeNameArray;
    NSMutableArray *itemInDateArray;
    NSMutableArray *itemAttributesArray;
    
    NSString *seriesCodeStr;
    NSString *seriesTypeStr;
    
    NSString *weightStr;
    NSString *cutGoldStr;
    NSString *processPriceStr;
    NSString *todayGoldPriceStr;
    
    NSInteger priceDetailCellTag;
    BOOL isOpened;
    BOOL chengSeListIsOpen;
    
   // NSMutableArray *mGuidesArray;
    NSMutableArray *guideNameArray;
    NSMutableArray *guideCodeArray;
    NSString *guideCodeStr;
    NSString *memberCodeStr;
    
  
    NSString *severStr;

 NSString *openIdStr;
}
@property (strong, nonatomic) NSString *areaValue, *cityValue;
@property (strong, nonatomic) HZAreaPickerView *locatePicker;
@end

@implementation Product_SeriesViewController
@synthesize areaValue=_areaValue, cityValue=_cityValue;
@synthesize locatePicker=_locatePicker;
-(void)viewWillAppear:(BOOL)animated
{
    if ([Global getLoginToken].length>0) {
    
   
    [Global setShopCartID:2];
     [Global setOrderID:2];
    [Global setScanID:2];
    _searchSeriesTextField.text=@"";
   severStr=@"Product/ItemList";
    mSeriesArray=[NSMutableArray array];
    seriesCodeAray=[NSMutableArray array];
    seriesNameArray=[NSMutableArray array];
    onHandArray=[NSMutableArray array];
    
  // mItemsArray=[NSMutableArray array];
   itemCodeArray=[NSMutableArray array];
   itemNameArray=[NSMutableArray array];
   itemAttributesArray=[NSMutableArray array];
   itemWhereArray=[NSMutableArray array];
   itemPriceArray=[NSMutableArray array];
   itemUrlArray=[NSMutableArray array];
   itemWeightArray=[NSMutableArray array];
   itemSeriesNameArray=[NSMutableArray array];
   itemTypeNameArray=[NSMutableArray array];
   itemInDateArray=[NSMutableArray array];
//    [_leftTableView setBackgroundColor:[UIColor colorWithRed:241.0f/255.0f green:241.0f/255.0f blue:241.0f/255.0f alpha:1.0f]];
    [_shopCartBtn addTarget:self action:@selector(shopCartBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [_leftTableView setBackgroundColor:[UIColor clearColor]];
    [_rightTableView reloadData];
   
    seriesTypeStr=_typeCodeStr;
    [self requestSeriesList];
    }

}
-(void) loadItemNextPage:(NSUInteger)oldPageNum {
    if(oldPageNum!=0 && _TotalCount<=itemCodeArray.count)
        return;
    if(oldPageNum == 0){
        [itemCodeArray removeAllObjects];
        [_rightTableView reloadData];
    }
    _PageIndex=oldPageNum+1;
    [self requestItemList: _PageIndex pageSize:6];
}
-(void)requestItemList:(NSUInteger)pageIndex pageSize:(NSUInteger)pageSize
{
    
    if ([Global getLoginToken].length>0) {
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        NSMutableDictionary *params=[[NSMutableDictionary alloc] init];
        [params setObject:[Global getLoginToken] forKey:@"Token"];
        NSNumber *pageSizeNumber = [NSNumber numberWithInteger:pageSize];
        NSNumber *pageIndexNumber = [NSNumber numberWithInteger:pageIndex];
        //        NSString *pageSizeStr=[NSString stringWithFormat:@"%d",pageSize];
        //        NSString *pageIndexStr=[NSString stringWithFormat:@"%d",pageIndex];
        
        [params setObject:pageSizeNumber forKey:@"PageSize"];
        [params setObject:pageIndexNumber forKey:@"PageIndex"];
        [params setObject:_searchSeriesTextField.text forKey:@"KeyWord"];
        [params setObject:_typeCodeStr forKey:@"ItypeCode"];
        [params setObject:seriesCodeStr forKey:@"ISectypeCode"];
        if ([severStr isEqualToString:@"Product/GetPItemList"]) {
            [params setObject:@"Series" forKey:@"BType"];
        }
        // NSLog(@"paramsLIST====%@",params);
        [HttpRequest requestData:severStr params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
               // NSLog(@"seve2222====%@",severDataDict.dataDict);
                    _TotalCount=[[severDataDict.dataDict objectForKey:@"TotalCount"] integerValue];
                   
                    if (_TotalCount%6!=0) {
                        _TotalPage=_TotalCount/6+1;
                    }
                    else if (_TotalCount%6==0)
                    {
                        _TotalPage=_TotalCount/6;
                    }
                  NSMutableArray * mItemsArray=[NSMutableArray arrayWithArray:[severDataDict.dataDict objectForKey:@"DataLine"]];
                     // NSLog(@"mItemsArray===%@",mItemsArray);
                    if ( mItemsArray.count>0) {
                        for (int i=0; i< mItemsArray.count; i++) {
                            
                            [itemCodeArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"ItemCode"]];
                            [itemNameArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"ItemName"]];
                            [itemAttributesArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"Attributes"]];
                            [itemWhereArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"WhsName"]];
                            [itemUrlArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"ImageUrl"]];
                            [itemPriceArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"Price"]];
                            [itemWeightArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"Gram"]];
                            [itemSeriesNameArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"SeriesName"]];
                            [itemTypeNameArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"ItypeName"]];
                            [itemInDateArray addObject:[[mItemsArray objectAtIndex:i] objectForKey:@"InDate"]];
                           
                        }
                    }
                   //  NSLog(@"itemAttributesArray===%@",itemAttributesArray);
                    
                    [_rightTableView reloadData];
                    
                    
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    //  [Global showTextHud:requestResultStr view:self.view];
                    [Global showTextHudSub:requestResultStr view:self.view];
                    
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                    [Global loginViewController:self noteStr:requestResultStr];
                     //   [Global loginViewController:self];
                    }

                }
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
        }];
        
    }
}

-(void)requestSeriesList
{
    if ([Global getLoginToken].length>0) {
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
        NSMutableDictionary *params=[[NSMutableDictionary alloc] init];
        [params setObject:[Global getLoginToken] forKey:@"Token"];
        [params setObject:seriesTypeStr forKey:@"ItypeCode"];
        // NSLog(@"params=%@",params);
        [HttpRequest requestData:@"Product/SeriesList" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
          //   NSLog(@"tt=%@",severDataDict.dataDict);
            if (isSuccess) {
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
//                    NSLog(@"tt=%@",severDataDict.dataDict);
                    [Global hideProgressHUDInternal:self.view];
                    [seriesCodeAray removeAllObjects];
                    [seriesNameArray removeAllObjects];
                    [onHandArray removeAllObjects];
                    
                    mSeriesArray=[severDataDict.dataDict objectForKey:@"DataLine"];
                    for (int i=0; i<mSeriesArray.count; i++) {
                        [seriesCodeAray addObject:[[mSeriesArray objectAtIndex:i] objectForKey:@"ISectypeCode"]];
                        [seriesNameArray addObject:[[mSeriesArray objectAtIndex:i] objectForKey:@"ISectypeName"]];
                        [onHandArray addObject:[[mSeriesArray objectAtIndex:i] objectForKey:@"OnHand"]];
                    }

                    [_leftTableView reloadData];
                    if (mSeriesArray.count>_selectID) {
                    NSIndexPath *ip=[NSIndexPath indexPathForRow:_selectID inSection:0];
                    [_leftTableView selectRowAtIndexPath:ip animated:YES scrollPosition:UITableViewScrollPositionBottom];
                        
                     //   UITableViewCell *cell = [_leftTableView cellForRowAtIndexPath:ip];
                      //  ProductCommonTableViewCell *hjCell=( ProductCommonTableViewCell *)cell;
                       
                       // hjCell.lineLabel.hidden=NO;
                        seriesCodeStr=[[mSeriesArray objectAtIndex:_selectID] objectForKey:@"ISectypeCode"];
                        [itemCodeArray removeAllObjects];
                        [itemNameArray removeAllObjects];
                        [itemAttributesArray removeAllObjects];
                        [itemWhereArray removeAllObjects];
                        [itemUrlArray removeAllObjects];
                        [itemPriceArray removeAllObjects];
                        [itemWeightArray removeAllObjects];
                        [itemSeriesNameArray removeAllObjects];
                        [itemTypeNameArray removeAllObjects];
                        [itemInDateArray removeAllObjects];

                    _PageIndex=0;
                    [self loadItemNextPage:_PageIndex];
                    }
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                    //  [Global showTextHud:requestResultStr view:self.view];
                    //  UIViewController *controller=[[GlobalViewController alloc]init];
                    //  [self.navigationController pushViewController:controller animated:YES];
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                             [Global loginViewController:self noteStr:requestResultStr];
                    //[Global loginViewController:self];
                    }
                    
                }
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
        }];
        
    }

}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
   

   if (tableView==_leftTableView) {
        return seriesCodeAray.count;
    }
   
    else if(tableView==_rightTableView)
    {
        return itemCodeArray.count;
    }
    
    return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView==_leftTableView) {
        return 90;
    }
    else if(tableView==_rightTableView)
        return 140;
  
    else
        return 50;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (tableView==_leftTableView) {
        static NSString * const  leftIdentifier = @"leftIdentifier";
        FactoryNewProductLeftTableViewCell *cell=( FactoryNewProductLeftTableViewCell *)[tableView dequeueReusableCellWithIdentifier: leftIdentifier];
        if (cell==nil) {
            NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"FactoryNewProductLeftTableViewCell" owner:self options:nil];
            cell = [array objectAtIndex:0];
        }
        cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame] ;
        cell.selectedBackgroundView.backgroundColor = [UIColor clearColor];
        if (onHandArray.count>0) {
            cell.productContentLabel.text=[NSString stringWithFormat:@"共有%d款商品",[[onHandArray objectAtIndex:indexPath.row] integerValue]];
        }
        if (seriesNameArray.count>0) {
            cell.productTitleLabel.text=[seriesNameArray objectAtIndex:indexPath.row];
        }
        return cell;

        
//        static NSString * const  leftIdentifier = @"leftIdentifier";
//        ProductCommonTableViewCell *cell=( ProductCommonTableViewCell *)[tableView dequeueReusableCellWithIdentifier: leftIdentifier];
//        if (cell==nil) {
//            NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"ProductCommonTableViewCell" owner:self options:nil];
//            cell = [array objectAtIndex:0];
//        }
//        cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.frame] ;
//        cell.selectedBackgroundView.backgroundColor = [UIColor clearColor];
//             if (seriesNameArray.count>0) {
//            cell.nameLabel.text=[seriesNameArray objectAtIndex:indexPath.row];
//        }
//        if (onHandArray.count>0) {
//            cell.contentLabel.text=[NSString stringWithFormat:@"共有%d件商品",[[onHandArray objectAtIndex:indexPath.row] integerValue]];
//        }
//        return cell;
    }
      else if(tableView==_rightTableView)
    {
        static NSString * const  rightIdentifier = @"rightIdentifier";
        ProductCommon2TableViewCell *cell=( ProductCommon2TableViewCell *)[tableView dequeueReusableCellWithIdentifier: rightIdentifier];
        if (cell==nil) {
            NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"ProductCommon2TableViewCell" owner:self options:nil];
            cell = [array objectAtIndex:0];
            cell.delegate=self;
        }
        cell.addToShopCartBtn.tag=indexPath.row;
        cell.buyBtn.tag=indexPath.row;
        if (itemUrlArray.count>0) {
            if ([itemUrlArray objectAtIndex:indexPath.row]!=[NSNull null]&&[[itemUrlArray objectAtIndex:indexPath.row] length]>0) {
                [ cell.productImageView setImageWithURL:[NSURL URLWithString:[itemUrlArray objectAtIndex:indexPath.row] ]];
            }
            else
            {
                [cell.productImageView setImage:[UIImage imageNamed:@"zhanweitu_.png"]];
            }
            
        }
        if (itemAttributesArray.count>0) {
            if ([itemAttributesArray objectAtIndex:indexPath.row]!=[NSNull null]) {
                cell.attributesLabel.text=[NSString stringWithFormat:@"%@",[itemAttributesArray objectAtIndex:indexPath.row]];
               
            }
             [Global resizeForLable:cell.attributesLabel WithText:cell.attributesLabel.text parentView:self.view];
            //[self resizeLabel: cell.attributesLabel];
            
            CGRect frame= cell.weightTagLabel.frame;
            if ([[itemAttributesArray objectAtIndex:indexPath.row] length]>0) {
            
            frame.origin.x=cell.attributesLabel.frame.origin.x+cell.attributesLabel.frame.size.width+12;
            }
            else
            {
                 frame.origin.x=cell.attributesLabel.frame.origin.x+cell.attributesLabel.frame.size.width;
            }
            cell.weightTagLabel.frame=frame;
            
            CGRect frame1= cell.weightLabel.frame;
            frame1.origin.x=cell.weightTagLabel.frame.origin.x+cell.weightTagLabel.frame.size.width+1;
            cell.weightLabel.frame=frame1;

        }
        if (itemNameArray.count>0) {
             if ([itemCodeArray objectAtIndex:indexPath.row]!=[NSNull null]&&[itemNameArray objectAtIndex:indexPath.row]!=[NSNull null]) {
            cell.productNameLabel.text=[NSString stringWithFormat:@"%@ %@",[itemCodeArray objectAtIndex:indexPath.row],[itemNameArray objectAtIndex:indexPath.row]];
             }
        }
        if (itemPriceArray.count>0) {
             if ([itemPriceArray objectAtIndex:indexPath.row]!=[NSNull null])
             {
            float AvgPrice=[[itemPriceArray objectAtIndex:indexPath.row] floatValue];
            NSString *AvgPriceStr=[Global floatConvertPercentile:AvgPrice];

            cell.productPriceLabel.text=[NSString stringWithFormat:@"¥%@",AvgPriceStr];
             }
        }
        if(itemWhereArray.count>0)
            
        {
            if ([itemWhereArray objectAtIndex:indexPath.row]!=[NSNull null])
            {
            cell.stockAddressLabel.text=[itemWhereArray objectAtIndex:indexPath.row];
            }
        }
        if (itemWeightArray.count>0) {
            if ([itemWeightArray objectAtIndex:indexPath.row]!=[NSNull null])
            {
            cell.weightLabel.text=[NSString stringWithFormat:@"%0.02fg",[[itemWeightArray objectAtIndex:indexPath.row] floatValue]];
            [Global resizeForLable:cell.weightLabel WithText:cell.weightLabel.text parentView:self.view];
            //[self resizeLabel: cell.weightLabel];
            CGRect frame= cell.productPriceLabel.frame;
            frame.origin.x=cell.weightLabel.frame.origin.x+cell.weightLabel.frame.size.width+12;
            cell.productPriceLabel.frame=frame;
            }
        }

        if (indexPath.row == [itemCodeArray count] - 1)
        {
            if (_PageIndex<=_TotalPage) {
                //  NSLog(@"###LOADING???");
                [self loadItemNextPage:_PageIndex];
            }
        }
        
        return cell;
    }
    return nil;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView==_leftTableView) {
        [itemCodeArray removeAllObjects];
        [itemNameArray removeAllObjects];
        [itemAttributesArray removeAllObjects];
        [itemWhereArray removeAllObjects];
        [itemUrlArray removeAllObjects];
        [itemPriceArray removeAllObjects];
        [itemWeightArray removeAllObjects];
        [itemSeriesNameArray removeAllObjects];
        [itemTypeNameArray removeAllObjects];
        [itemInDateArray removeAllObjects];

        
//        NSIndexPath *indexPath1= [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
//        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath1];
//        ProductCommonTableViewCell *leftCell=( ProductCommonTableViewCell *)cell;
//       leftCell.selectedBackgroundView.backgroundColor = [UIColor clearColor];
        _selectID=indexPath.row;
        seriesCodeStr=[seriesCodeAray objectAtIndex:indexPath.row] ;
        _PageIndex=0;
        [self loadItemNextPage:_PageIndex];
           }
      else if (tableView==_rightTableView)
    {
        if (itemCodeArray.count>0) {
       
        if ([self.delegate respondsToSelector:@selector(rightTableView:code:_itemCodeArray:_itemNameArray:_itemWhereArray:_itemPriceArray:_itemUrlArray:_itemWeightArray:_itemSeriesNameArray:_itemTypeNameArray:_itemInDateArray:)]) {
            
        
            [self.delegate rightTableView:indexPath.row code:[itemCodeArray objectAtIndex:indexPath.row] _itemCodeArray:itemCodeArray _itemNameArray:itemNameArray _itemWhereArray:itemWhereArray _itemPriceArray:itemPriceArray _itemUrlArray:itemUrlArray _itemWeightArray:itemWeightArray _itemSeriesNameArray:itemSeriesNameArray _itemTypeNameArray:itemTypeNameArray _itemInDateArray:itemInDateArray];
        }
        }
    }
    
}

-(IBAction)backClick:(id)sender
{
    if ([self.delegate respondsToSelector:@selector(product_SeriesBackClick)]) {
        
        [self.delegate product_SeriesBackClick];
    }

}
-(void)addToShopCartClick:(NSUInteger)tag
{
    if ([Global getLoginToken].length>0) {
        [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
       
            NSMutableDictionary *params=[[NSMutableDictionary alloc] init];
            [params setObject:[Global getLoginToken] forKey:@"Token"];
            [params setObject:[itemCodeArray objectAtIndex:tag] forKey:@"ItemCode"];
            [params setObject:@"A" forKey:@"EditType"];
        
            //  NSLog(@"addToShopCartParams===%@",params);
            [HttpRequest requestData:@"Guide/EditShopCart" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
                if (isSuccess) {
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                        [Global hideProgressHUDInternal:self.view];
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        //  [Global showTextHud:requestResultStr view:self.view];
                        [Global showTextHudSub:requestResultStr view:self.view];

                        // NSLog(@"addToShopCart===%@",severDataDict.dataDict);
//                        if ([self.delegate respondsToSelector:@selector(product_SeriesShopCartClick)]) {
//                            
//                            [self.delegate product_SeriesShopCartClick];
//                        }
                    }
                    else
                    {
                        [Global hideProgressHUDInternal:self.view];
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        //  [Global showTextHud:requestResultStr view:self.view];
                        [Global showTextHudSub:requestResultStr view:self.view];
                        
                        if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                            [Global loginViewController:self noteStr:requestResultStr];
                         //   [Global loginViewController:self];
                        }
                    }
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    [Global showTextHudSub:@"连接失败" view:self.view];
                }
            }];
        }
    

}
-(void)shopCartBtnClick
{
   if ([self.delegate respondsToSelector:@selector(product_SeriesShopCartClick)]) {
    
             [self.delegate product_SeriesShopCartClick];
        }

}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
       if (textField==_searchSeriesTextField) {
        severStr=@"Product/GetPItemList";
       [itemCodeArray removeAllObjects];
       [itemNameArray removeAllObjects];
       [itemAttributesArray removeAllObjects];
       [itemWhereArray removeAllObjects];
       [itemUrlArray removeAllObjects];
       [itemPriceArray removeAllObjects];
       [itemWeightArray removeAllObjects];
       [itemSeriesNameArray removeAllObjects];
       [itemTypeNameArray removeAllObjects];
       [itemInDateArray removeAllObjects];
        _PageIndex=0;
        [self loadItemNextPage:_PageIndex];
         [_searchSeriesTextField resignFirstResponder];
    }
    return YES;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
